import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};

export type infoType = {
  projectUnityName:string,
	id?: number,
	userIds?: number,
  userId?: number,
	userNames?: string,
	unityId?: number,
	unityName?: string,
	phone?: string,
	projectRoleIds?: number,
	roles?: object,
  projectName?:any,
  projectIds?:any
}
export type infoTypeList = {
  data: infoType[];
  total: number;
};

const List = '/system/project/v2/project/authorizes';
const Url = '/system/project/v2/project/authorize';
export const getList = (params?: object) => {
  return http.request<commonResult<infoTypeList>>("get", List, {
    params
  });
};
export const getInfo = (params?: object) => {
  return http.request<commonResult<infoType>>("get", Url, {
    params
  });
};
export const addInfo = (data?: object) => {
  return http.request<commonResult<any>>("post", Url, {
    data
  });
};
export const editInfo = (data?: object) => {
  return http.request<commonResult<any>>("put", Url, {
    data
  });
};
export const deleteInfo = (data?: object) => {
  return http.request<commonResult<any>>("delete", Url, {
    data
  });
};
//1.5.9.6 根据项目id查询授权用户（下拉选择框）
export const getRoleauthorize = (params?: object) => {
  return http.request<commonResult<any>>("get", '/system/project/v2/project/authorize-user', {
    params
  });
}

/**1.5.9.7 根据单位id查询项目 */
export const getauthproject = (params?: object) => {
  return http.request<commonResult<any>>("get", '/system/project/v2/project/auth-project', {
    params
  });
}